<?php
namespace app\admin\controller;
use think\Db;
use app\common\controller\order\Orderget;
class Tuiguangqdhy extends Common
{
//  渠道列表页面
    public function index()
    {
		$Orderget=New Orderget();
		$RoleID=$Orderget->get_RoleID();
		if($RoleID=='48'){
		    $qudao=Db::table('xb_tg_admin')->where(['AdminID'=>session('id')])->select();	
		}else{
		  $qudao=$this->qudao();//调用渠道数据
		}
		$this->assign('qudao',$qudao);
		return $this->fetch();	
    }
//	 用户列表页面数据
    public function get_list()
    {
    	$Orderget=New Orderget();
		$RoleID=$Orderget->get_RoleID();
		$Orderget=new Orderget();
		$where=$Orderget->sorch();
		if($RoleID=='48'){
			if(empty($where['TgadminID'])){
			$TgadminIDdata=Db::table('xb_tg_admin')->where(['AdminID'=>session('id')])->field('ID')->select();
			$TgadminID=[];
			if(!empty($TgadminIDdata)){
				foreach ($TgadminIDdata as $k => $v) {
			     $TgadminID[]=$v['ID'];
				}
			}
			$where['TgadminID']=array('in',$TgadminID);
			}
		}
//		p($where);
		$page = input('page');
		$limit = input('limit');
		$re=Db::table('xb_mem_info')->page($page,$limit)->where($where)->order('ID desc')->select();
//		p($re);die;
		foreach ($re as $k => $v) {
			if($v['Status']=='1'){
				$v['Status']='<span style="color:write;">待审核</span>';
			}
			if($v['Status']=='2'){
					$v['Status']='<span style="color:green;">审核通过</span>';

			}
			if($v['Status']=='3'){
					$v['Status']='<span style="color:blue;">禁用</span>';

			}
			if($v['Status']=='4'){
					$v['Status']='<span style="color:red;">黑名单</span>';
			}
			$v['TgadminID']=Db::table('xb_tg_admin')->where(array('ID'=> $v['TgadminID']))->value('Name');
			//			身份证号码脱敏
			if(!empty($v['IDCard'])){
			            $v['IDCard']=dataDesensitization($v['IDCard'], $start = 3, $length = 8, '*');
			}else{
				$v['IDCard']='';
			}
//			姓名脱敏
			if(!empty($v['TrueName'])){
			            $v['TrueName']=dataDesensitization($v['TrueName'], $start = 0, $length = 2, '*');
			}else{
				$v['TrueName']='';
			}
			//手机号脱敏
			if(!empty($v['Mobile'])){
			            $v['Mobile']=dataDesensitization($v['Mobile'], $start = 3, $length = 4, '*');
			}else{
				$v['Mobile']='';
			}
			$re[$k]=$v;
		}
		$cuont=Db::table('xb_mem_info')->where($where)->count('ID');
		songsong($re,$cuont);
    }
	
	
	
}
